package com.zyg.cart.client;

import com.zyg.cart.enttiy.ItemEntity;
import com.zyg.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * ------------------------------
 * 作者: LMY
 * 接口-功能: XX
 * 创建时间: 2021-11-15 17:59
 * ------------------------------
 **/
@FeignClient(value = "zyg-manager",fallback = ManagerClientImpl.class )
public interface ManagerClient {

    @GetMapping("manager/item/info/{id}")
     R info(@PathVariable("id") Long id);

    @GetMapping("manager/item/findById/{id}")
    ItemEntity findById(@PathVariable("id") Long id);

}

@Component
class ManagerClientImpl implements ManagerClient{

    @Override
    public R info(Long id) {
        System.out.println("找不到Manager服务");
        return null;
    }

    @Override
    public ItemEntity findById(Long id) {
        System.out.println("找不到Manager服务");
        return null;
    }
}